﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using GosWeb.Models.Db;
using GosWeb.Biz;

namespace GosWeb.Models.Form
{
    public class BloodRelation
    {
        private string biA, biB;
        BiontBiz bb = BiontBiz.GetInstance();
        public BloodRelation()
        {
        }
        public string BiontID1
        {
            get
            {
                return biA;
            }
            set
            {
                biA = value.Trim();
            }
        }
        public string BiontID2
        {
            get
            {
                return biB;
            }
            set
            {
                biB = value.Trim();
            }
        }

        public Biont Biont1
        {
            get
            {
                return bb.FindBiont(biA);
            }
        }

        public Biont Biont2
        {
            get
            {
                return bb.FindBiont(biB);
            }
        }

        public List<Biont> CommonAncestors
        {
            get
            {
                List<Biont> commonAncestors = new List<Biont>();
                Biont b = bb.GetCommonAncestor(3, BiontID1, BiontID2);
                if (b != null)
                {
                    commonAncestors.Add(b);
                }
                return commonAncestors;
            }
        }
    }
}